<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <title>编辑会员资料 - 社交圈</title>
  <!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
  
  <style>
    :root {
      --primary: #4A6FFF;
      --primary-light: #E8F0FF;
      --text-primary: #1D2129;
      --text-secondary: #86909C;
      --border-light: #E5E6EB;
      --bg-white: #FFFFFF;
      --bg-light: #F2F3F5;
    }
    
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      background-color: var(--bg-light);
      color: var(--text-primary);
      font-size: 15px;
      line-height: 1.6;
      padding-bottom: 20px;
    }
    
    /* 顶部导航 */
    .page-header {
      background-color: var(--bg-white);
      padding: 15px 16px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid var(--border-light);
      position: sticky;
      top: 0;
      z-index: 100;
    }
    
    .header-title {
      font-size: 18px;
      font-weight: 600;
    }
    
    .header-btn {
      color: var(--primary);
      font-size: 16px;
      font-weight: 500;
      background: none;
      border: none;
      padding: 5px 10px;
    }
    
    .back-btn {
      color: var(--text-primary);
      font-size: 20px;
    }
    
    /* 资料编辑容器 */
    .profile-edit-container {
      background-color: var(--bg-white);
      margin: 12px;
      border-radius: 12px;
      overflow: hidden;
    }
    
    /* 头像上传区 */
    .avatar-upload-section {
      padding: 20px 16px;
      display: flex;
      flex-direction: column;
      align-items: center;
      border-bottom: 1px solid var(--border-light);
    }
    
    .avatar-container {
      position: relative;
      margin-bottom: 15px;
    }
    
    .avatar-preview {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid var(--border-light);
    }
    
    .avatar-upload-btn {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background-color: var(--primary);
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2px solid white;
    }
    
    .avatar-tips {
      color: var(--text-secondary);
      font-size: 13px;
    }
    
    /* 表单区域 */
    .form-section {
      padding: 10px 0;
    }
    
    .form-group {
      display: flex;
      align-items: center;
      padding: 14px 16px;
      border-bottom: 1px solid var(--border-light);
    }
    
    .form-group:last-child {
      border-bottom: none;
    }
    
    .form-label {
      width: 80px;
      font-size: 15px;
      color: var(--text-primary);
    }
    
    .form-control {
      flex: 1;
      border: none;
      padding: 0;
      font-size: 15px;
      color: var(--text-primary);
      outline: none;
    }
    
    .form-control::placeholder {
      color: var(--text-secondary);
    }
    
    .form-hint {
      color: var(--text-secondary);
      font-size: 14px;
    }
    
    .form-arrow {
      color: var(--border-light);
      font-size: 18px;
      margin-left: 5px;
    }
    
    .select-container {
      flex: 1;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    /* 性别选择 */
    .gender-select {
      flex: 1;
      display: flex;
      gap: 15px;
    }
    
    .gender-option {
      flex: 1;
      text-align: center;
      padding: 6px 0;
      border-radius: 6px;
      border: 1px solid var(--border-light);
      font-size: 15px;
      cursor: pointer;
    }
    
    .gender-option.selected {
      border-color: var(--primary);
      background-color: var(--primary-light);
      color: var(--primary);
    }
    
    /* 生日选择器 */
    .birthday-inputs {
      flex: 1;
      display: flex;
      gap: 8px;
    }
    
    .birthday-input {
      flex: 1;
      text-align: center;
      padding: 8px 0;
      border-radius: 6px;
      border: 1px solid var(--border-light);
      font-size: 15px;
    }
    
    /* 标签选择 */
    .tags-container {
      flex: 1;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      max-height: 100px;
      overflow-y: auto;
    }
    
    .tag-item {
      background-color: var(--bg-light);
      border-radius: 20px;
      padding: 4px 12px;
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    
    .tag-remove {
      color: var(--text-secondary);
      font-size: 12px;
      cursor: pointer;
    }
    
    .add-tag-btn {
      background-color: var(--primary-light);
      color: var(--primary);
      border-radius: 20px;
      padding: 4px 12px;
      font-size: 14px;
      border: none;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    
    /* 个人简介 */
    .bio-container {
      flex: 1;
    }
    
    .bio-textarea {
      width: 100%;
      border: none;
      resize: none;
      min-height: 80px;
      font-size: 15px;
      outline: none;
      line-height: 1.5;
    }
    
    .bio-count {
      text-align: right;
      color: var(--text-secondary);
      font-size: 13px;
      margin-top: 5px;
    }
    
    /* 隐私设置 */
    .switch-container {
      flex: 1;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    
    .switch-label {
      font-size: 15px;
    }
    
    .form-switch {
      padding-left: 0;
      margin-bottom: 0;
    }
    
    .form-check-input {
      width: 50px;
      height: 26px;
      border-radius: 20px;
    }
    
    .form-check-input:checked {
      background-color: var(--primary);
      border-color: var(--primary);
    }
    
    /* 底部提示 */
    .tips-section {
      padding: 20px 16px;
      color: var(--text-secondary);
      font-size: 13px;
      text-align: center;
    }
    
    /* 模态框样式 */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
    }
    
    .modal-content {
      background-color: white;
      border-radius: 12px;
      width: 85%;
      max-width: 300px;
    }
    
    .modal-header {
      padding: 16px;
      text-align: center;
      border-bottom: 1px solid var(--border-light);
    }
    
    .modal-title {
      font-size: 18px;
      font-weight: 600;
    }
    
    .modal-body {
      padding: 20px 16px;
    }
    
    .modal-options {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    
    .modal-option {
      padding: 12px 16px;
      border-radius: 8px;
      background-color: var(--bg-light);
      display: flex;
      align-items: center;
      gap: 12px;
      cursor: pointer;
    }
    
    .option-icon {
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-secondary);
    }
    
    .option-text {
      font-size: 16px;
    }
    
    .modal-footer {
      padding: 12px 16px;
      border-top: 1px solid var(--border-light);
      display: flex;
    }
    
    .modal-btn {
      flex: 1;
      padding: 10px;
      border-radius: 8px;
      border: none;
      font-size: 16px;
      font-weight: 500;
      margin: 0 5px;
    }
    
    .cancel-btn {
      background-color: var(--bg-light);
      color: var(--text-primary);
    }
    
    .confirm-btn {
      background-color: var(--primary);
      color: white;
    }
  </style>
</head>
<body>
  <!-- 顶部导航 -->
  <div class="page-header">
    <a href="#" class="back-btn">
      <i class="fa fa-arrow-left"></i>
    </a>
    <div class="header-title">编辑会员资料</div>
    <button class="header-btn save-btn">保存</button>
  </div>
  
  <!-- 资料编辑容器 -->
  <div class="profile-edit-container">
    <!-- 头像上传区 -->
    <div class="avatar-upload-section">
      <div class="avatar-container">
        <img src="https://picsum.photos/200/200?random=1" alt="当前头像" class="avatar-preview">
        <div class="avatar-upload-btn" id="change-avatar">
          <i class="fa fa-camera"></i>
        </div>
      </div>
      <div class="avatar-tips">点击更换头像，建议尺寸400x400px</div>
    </div>
    
    <!-- 表单区域 -->
    <div class="form-section">
      <div class="form-group">
        <div class="form-label">用户名</div>
        <input type="text" class="form-control" placeholder="请输入用户名" value="陈嘉欣">
        <i class="fa fa-angle-right form-arrow"></i>
      </div>
      
      <div class="form-group">
        <div class="form-label">昵称</div>
        <input type="text" class="form-control" placeholder="请输入昵称" value="设计爱好者">
      </div>
      
      <div class="form-group">
        <div class="form-label">性别</div>
        <div class="gender-select">
          <div class="gender-option">男</div>
          <div class="gender-option selected">女</div>
          <div class="gender-option">保密</div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="form-label">生日</div>
        <div class="birthday-inputs">
          <input type="text" class="birthday-input" placeholder="年" value="1990">
          <input type="text" class="birthday-input" placeholder="月" value="05">
          <input type="text" class="birthday-input" placeholder="日" value="18">
        </div>
      </div>
      
      <div class="form-group">
        <div class="form-label">所在地</div>
        <div class="select-container">
          <div class="form-hint">北京市 朝阳区</div>
          <i class="fa fa-angle-right form-arrow"></i>
        </div>
      </div>
      
      <div class="form-group">
        <div class="form-label">职业</div>
        <input type="text" class="form-control" placeholder="请输入职业" value="UI/UX设计师">
      </div>
      
      <div class="form-group">
        <div class="form-label">公司</div>
        <input type="text" class="form-control" placeholder="请输入公司名称" value="创意设计工作室">
      </div>
      
      <div class="form-group">
        <div class="form-label">个人标签</div>
        <div class="tags-container">
          <div class="tag-item">
            <span>设计</span>
            <i class="fa fa-times tag-remove"></i>
          </div>
          <div class="tag-item">
            <span>摄影</span>
            <i class="fa fa-times tag-remove"></i>
          </div>
          <div class="tag-item">
            <span>旅行</span>
            <i class="fa fa-times tag-remove"></i>
          </div>
          <button class="add-tag-btn">
            <i class="fa fa-plus"></i>
            <span>添加</span>
          </button>
        </div>
      </div>
      
      <div class="form-group">
        <div class="form-label">个人简介</div>
        <div class="bio-container">
          <textarea class="bio-textarea" placeholder="请介绍一下自己..." maxlength="150">高级UI/UX设计师，热爱生活与创作，分享设计心得和生活点滴。</textarea>
          <div class="bio-count">
            <span class="current-count">46</span>/150
          </div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="form-label">会员身份</div>
        <div class="select-container">
          <div class="form-hint">高级会员 (2024.12.31到期)</div>
          <i class="fa fa-angle-right form-arrow"></i>
        </div>
      </div>
      
      <div class="form-group">
        <div class="form-label">隐私设置</div>
        <div class="switch-container">
          <span class="switch-label">仅好友可见我的资料</span>
          <div class="form-check form-switch">
            <input class="form-check-input" type="checkbox" id="privacy-switch">
          </div>
        </div>
      </div>
      
      <div class="form-group">
        <div class="form-label">账号绑定</div>
        <div class="select-container">
          <div class="form-hint">微信、QQ、微博</div>
          <i class="fa fa-angle-right form-arrow"></i>
        </div>
      </div>
    </div>
  </div>
  
  <!-- 底部提示 -->
  <div class="tips-section">
    完成资料填写有助于获得更好的社交体验<br>
    您的资料将按照隐私设置进行展示
  </div>
  
  <!-- 头像上传模态框 (默认隐藏) -->
  <div class="modal-overlay" id="avatar-modal" style="display: none;">
    <div class="modal-content">
      <div class="modal-header">
        <div class="modal-title">更换头像</div>
      </div>
      <div class="modal-body">
        <div class="modal-options">
          <div class="modal-option" id="take-photo">
            <div class="option-icon">
              <i class="fa fa-camera"></i>
            </div>
            <div class="option-text">拍摄照片</div>
          </div>
          <div class="modal-option" id="choose-photo">
            <div class="option-icon">
              <i class="fa fa-image"></i>
            </div>
            <div class="option-text">从相册选择</div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button class="modal-btn cancel-btn" id="cancel-avatar">取消</button>
      </div>
    </div>
  </div>
  
  <!-- 添加标签模态框 (默认隐藏) -->
  <div class="modal-overlay" id="tag-modal" style="display: none;">
    <div class="modal-content">
      <div class="modal-header">
        <div class="modal-title">添加个人标签</div>
      </div>
      <div class="modal-body">
        <input type="text" class="form-control" id="tag-input" placeholder="输入标签，最多5个字符">
      </div>
      <div class="modal-footer">
        <button class="modal-btn cancel-btn" id="cancel-tag">取消</button>
        <button class="modal-btn confirm-btn" id="confirm-tag">确定</button>
      </div>
    </div>
  </div>
  
  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  
  <script>
    // 保存按钮点击事件
    document.querySelector('.save-btn').addEventListener('click', function() {
      alert('资料保存成功！');
    });
    
    // 返回按钮点击事件
    document.querySelector('.back-btn').addEventListener('click', function() {
      if (confirm('您有未保存的修改，确定要离开吗？')) {
        // 这里可以添加返回上一页的逻辑
        history.back();
      }
    });
    
    // 头像上传相关
    const avatarModal = document.getElementById('avatar-modal');
    
    document.getElementById('change-avatar').addEventListener('click', function() {
      avatarModal.style.display = 'flex';
    });
    
    document.getElementById('cancel-avatar').addEventListener('click', function() {
      avatarModal.style.display = 'none';
    });
    
    document.getElementById('take-photo').addEventListener('click', function() {
      alert('调用相机');
      avatarModal.style.display = 'none';
    });
    
    document.getElementById('choose-photo').addEventListener('click', function() {
      alert('打开相册选择图片');
      avatarModal.style.display = 'none';
    });
    
    // 性别选择
    document.querySelectorAll('.gender-option').forEach(option => {
      option.addEventListener('click', function() {
        document.querySelectorAll('.gender-option').forEach(opt => {
          opt.classList.remove('selected');
        });
        this.classList.add('selected');
      });
    });
    
    // 个人简介字数统计
    const bioTextarea = document.querySelector('.bio-textarea');
    const currentCount = document.querySelector('.current-count');
    
    bioTextarea.addEventListener('input', function() {
      const length = this.value.length;
      currentCount.textContent = length;
      
      if (length > 150) {
        this.value = this.value.substring(0, 150);
        currentCount.textContent = 150;
      }
    });
    
    // 标签相关
    const tagModal = document.getElementById('tag-modal');
    const tagInput = document.getElementById('tag-input');
    const tagsContainer = document.querySelector('.tags-container');
    
    document.querySelector('.add-tag-btn').addEventListener('click', function() {
      tagInput.value = '';
      tagModal.style.display = 'flex';
      tagInput.focus();
    });
    
    document.getElementById('cancel-tag').addEventListener('click', function() {
      tagModal.style.display = 'none';
    });
    
    document.getElementById('confirm-tag').addEventListener('click', function() {
      const tagText = tagInput.value.trim();
      if (tagText && tagText.length <= 5) {
        // 检查标签数量，最多6个
        const tagItems = document.querySelectorAll('.tag-item');
        if (tagItems.length < 6) {
          const newTag = document.createElement('div');
          newTag.className = 'tag-item';
          newTag.innerHTML = `
            <span>${tagText}</span>
            <i class="fa fa-times tag-remove"></i>
          `;
          
          // 添加删除事件
          newTag.querySelector('.tag-remove').addEventListener('click', function() {
            newTag.remove();
          });
          
          // 插入到添加按钮前
          tagsContainer.insertBefore(newTag, document.querySelector('.add-tag-btn'));
          tagModal.style.display = 'none';
        } else {
          alert('最多只能添加6个标签');
        }
      } else if (tagText.length > 5) {
        alert('标签不能超过5个字符');
      } else {
        alert('请输入标签内容');
      }
    });
    
    // 已存在标签的删除功能
    document.querySelectorAll('.tag-remove').forEach(btn => {
      btn.addEventListener('click', function() {
        this.parentElement.remove();
      });
    });
    
    // 点击模态框外部关闭
    window.addEventListener('click', function(e) {
      if (e.target.classList.contains('modal-overlay')) {
        e.target.style.display = 'none';
      }
    });
  </script>
</body>
</html>
